import React, { useEffect } from 'react'
import { Swiper, Image, Lazyload } from 'react-vant';
import { useSelector, useDispatch } from 'react-redux';
import { async_gettypelist } from '../store/Slice';

export default function Home() {

    /* 轮播图图片数据 */
    let dispatch = useDispatch()
    useEffect(() => {
        dispatch(async_gettypelist())
    }, [])
    let obj = useSelector(state => state.crms1)
    console.log(obj);




    return (
        <div>
            {/* 轮播图 */}
            <Swiper autoplay={2000}>
                {obj.typelist.map((item) => (
                    <Swiper.Item key={item.id}>
                        <Image src={item.img} height={150} />
                    </Swiper.Item>
                ))}
            </Swiper>

        </div>
    )
}
